package com.ruoyi.app.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.wuliu.domain.TCompany;
import com.ruoyi.web.wuliu.service.ITCompanyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 储仓分流Controller
 * 
 * @author ruoyi
 * @date 2023-12-20
 */

@Api(tags = "小程序端-储仓分流")
@RestController
@RequestMapping("/app/company")
public class APPTCompanyController extends BaseController
{
    @Autowired
    private ITCompanyService tCompanyService;

    /**
     * 查询储仓分流列表
     */
    @ApiOperation("查询储仓分流列表")
    @GetMapping("/list")
    public TableDataInfo list(TCompany tCompany)
    {
        startPage();
        List<TCompany> list = tCompanyService.selectTCompanyList(tCompany);
        return getDataTable(list);
    }

    /**
     * 获取储仓分流详细信息
     */
    @ApiOperation("获取储仓分流详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tCompanyService.selectTCompanyById(id));
    }

    /**
     * 新增储仓分流
     */
    @ApiOperation("新增储仓分流")
    @PostMapping
    public AjaxResult add(@RequestBody TCompany tCompany)
    {
        return toAjax(tCompanyService.insertTCompany(tCompany));
    }

    /**
     * 修改储仓分流
     */
    @PutMapping
    @ApiOperation("修改储仓分流")
    public AjaxResult edit(@RequestBody TCompany tCompany)
    {
        return toAjax(tCompanyService.updateTCompany(tCompany));
    }

    /**
     * 删除储仓分流
     */
    @ApiOperation("删除储仓分流")
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tCompanyService.deleteTCompanyByIds(ids));
    }
}
